<template>
  <view>
    <web-view @hashchange="hashchange" :webview-styles="webviewStyles" :src="fullUrl" @message="getMessage" @load="load" @error="error"></web-view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      webviewStyles: {
        progress: {
          color: "#FFA900",
        },
      },
      baseUrl: "https://hiep-test.fintechabchina.com/jtpdev/jtp-shkp-h5/#/",
      fullUrl: "",
    };
  },
  onLoad: function (option) {
    // 上个页面把path拼接过来后期拼接url
    let loadUrl = this.baseUrl + decodeURIComponent(option.path);
    console.log(this.loadUrl)

    if (loadUrl.indexOf("?") == -1) {
      this.fullUrl = loadUrl + "?token=" + uni.getStorageSync("token");
    } else {
      this.fullUrl = loadUrl + "&token=" + uni.getStorageSync("token");
    }
    console.log(this.fullUrl)
  },
  methods: {
    load(e) {
      // console.log("webview", e);
    },
    error() {},
    hashchange() {
      console.log("webview", e);
    },
    getMessage(event) {
      console.log("event", event);
      uni.showModal({
        content: JSON.stringify(event.detail.data),
      });
    },
  },
};
</script>

<style>
</style>

